package com.srd.phone.bean;


import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

public class BankList {

    public int id;
    public String ctime;
    public String numbers;
    public String banknm;

    public static List<BankList> parseData(String json){
        List<BankList> list = new ArrayList<>();
        try {
            JSONArray jsonArray = new JSONArray(json);
            for (int i = 0; i < jsonArray.length(); i++) {
                BankList item = new BankList();
                JSONObject jsonObject = jsonArray.getJSONObject(i);
                item.id = jsonObject.optInt("id");
                item.ctime = jsonObject.optString("ctime");
                String str = jsonObject.optString("numbers");
                item.numbers = str.substring(str.length() - 4, str.length());
                item.banknm = jsonObject.optString("banknm");
                list.add(item);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return list;
    }
}
